home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1997 April / EnigmA AMIGA RUN 17 (1997)(G.R. Edizioni)(IT)[!][issue 1997-04][EAR-CD].iso / EARCD / gfx / board / rtgmv13.lha / goodies / rtggadgets / RTGGadgets.h < prev    next >
C/C++ Source or Header  |  1996-06-25  |  5KB  |  130 lines

  1. /*
  2.  *  RTGGadgets.h V1.2
  3.  *
  4.  *  A package to use gadget-like input elements on RTG screens
  5.  *
  6.  *  Copyright © 1996 by Thomas and Hans-Joerg Frieden
  7.  *  Written by Thomas Frieden
  8.  *  Technical assistance by Hans-Joerg Frieden
  9.  *
  10.  *  This software may be freely distributed. The copyright remains with
  11.  *  the copyright holders. For further information, see legal.doc.
  12.  *  In no way may this software be modified without permission of the
  13.  *  copyright holders.
  14.  *
  15.  *  This software is provided "as is", and may only be used at your own risk.
  16.  *  The copyright holder and/or the authors can not be held responible for any
  17.  *  damage the usage of this software may cause. To put it in other words, we are not
  18.  *  responsible if your cat dies while using this software.
  19.  *
  20.  *  Version         Comment
  21.  *  --------------------------------------------------------------
  22.  *  0.1             Initial Version without custom functions
  23.  *  1.0             first full release
  24.  *  1.1             Done some renaming to variables and types
  25.  *                  to keep up with the naming sceme (e.g. RTG*)
  26.  *  1.2             Added keypress activation of gadgets
  27.  */
  28.  
  29. #ifndef _RTGGADGETS_H_
  30. #define _RTGGADGETS_H_
  31.  
  32. struct RTGGadget {
  33.     struct RTGGadget *rg_Next;      /*  Next gadget in chain  */
  34.     int rg_ID;                      /*  Number of gadget  */
  35.     int rg_Left;                    /*  Left edge  */
  36.     int rg_Top;                     /*  Top edge  */
  37.     int rg_Width;                   /*  Width of hitbox  */
  38.     int rg_Height;                  /*  Height of hitbox  */
  39.     int rg_Flags;                   /*  various flags  */
  40.     int rg_HitPen;                  /*  Pen to use for hitbox */
  41.     int rg_DownPen;                 /*  Pen for standard DownRender */
  42.     int rg_UpPen;                   /*  Pen for standadr UpRender */
  43.     int (*rg_HitTest)();            /*  Custom hittest  */
  44.     void (*rg_HitRender)();         /*  Custom rendering function  */
  45.     void (*rg_DownRender)();        /*  Custom pressed rendering function */
  46.     void (*rg_UpRender)();          /*  Custom released rendering */
  47.     APTR rg_UserData;               /*  User can put data here */
  48.     APTR rg_ExtHandle;              /*  Reserved for future extensions */
  49.     char rg_Key;                    /*  If non-zero, this key activates gadget */
  50. };
  51.  
  52. #define RGADF_HITHILITE     1       /*  Hilite if mouse over hitbox */
  53.  
  54. #define RGADT_LeftEdge      TAG_USER + 1    /*  These tags set the fields */
  55. #define RGADT_TopEdge       TAG_USER + 2    /*  in the RTGGadget structure */
  56. #define RGADT_Width         TAG_USER + 3
  57. #define RGADT_Height        TAG_USER + 4
  58. #define RGADT_Flags         TAG_USER + 5
  59. #define RGADT_HitTest       TAG_USER + 6
  60. #define RGADT_HitRender     TAG_USER + 7
  61. #define RGADT_DownRender    TAG_USER + 8
  62. #define RGADT_UpRender      TAG_USER + 9
  63. #define RGADT_Force         TAG_USER + 10   /*  Error if ID is in use */
  64. #define RGADT_HitPen        TAG_USER + 11
  65. #define RGADT_UpPen         TAG_USER + 12
  66. #define RGADT_DownPen       TAG_USER + 13
  67. #define RGADT_UserData      TAG_USER + 14
  68. #define RGADT_Key           TAG_USER + 15
  69.  
  70. struct RTGGList {
  71.     struct RTGGadget *gl_First;     /*  First gadget of this screen */
  72.     struct RtgScreen *gl_Screen;    /*  Pointer to this screen  */
  73.     int gl_Buffer;                  /*  Number of buffer to draw into */
  74.     struct RTGGadget *gl_Hit;       /*  Pointer to gadget mouse is pointing to */
  75.     struct RTGGadget *gl_Selected;  /*  Selected Gadget */
  76.     BOOL gl_Mode;                   /*  TRUE means mouse button is down */
  77.     int gl_Flags;                   /*  various flags */
  78.     struct RTGGadget *gl_Reset;     /*  Reset this gadget to up */
  79. };
  80.  
  81. typedef struct {
  82.     UBYTE MK1, MK2, MK3;
  83.     UBYTE UK1, UK2, UK3;
  84.     UBYTE LastKey;
  85.     UBYTE Keys[0x60];
  86.     WORD MouseX, MouseY;
  87. } RTGInpRec; /*, *Inp; */
  88.  
  89. extern struct MsgPort * RTGInputMsgPort;
  90. extern struct IOStdReq * RTGInputIO;
  91. extern struct Interrupt InputHandler;
  92. extern RTGInpRec RTGInputRecord;
  93. extern struct Device *ConsoleDevice;
  94. extern struct IOStdReq RTGConsoleIO;
  95. extern struct InputEvent RTGIe;
  96. extern struct TagItem mtag[3];
  97. extern struct TagItem ctag[3];
  98.  
  99. /*
  100.  *  Prototypes
  101.  *
  102.  *  The functions in this package use the RTG (pre|suf)fix.
  103.  *  Note that this is all caps to tell that these functions do
  104.  *  not belong to the rtmaster.library, but are used in a
  105.  *  package for the library.
  106.  *
  107.  */
  108.  
  109. struct RTGGList * CreateRTGGList(struct RtgScreen * , int );
  110. int CreateRTGGadgetA(struct RTGGList * , int , struct TagItem * );
  111. int __stdargs CreateRTGGadget(struct RTGGList * , int , Tag , ...);
  112. int DeleteRTGGadget(struct RTGGList * , int );
  113. int RTGGHitTest(struct RTGGadget * , int , int );
  114. void DrawRTGBox(struct RtgScreen * , APTR , int , int , int , int , char );
  115. void RTGGHitRender(struct RTGGList * , struct RTGGadget * );
  116. void RTGGDownRender(struct RTGGList * , struct RTGGadget * );
  117. void RTGGUpRender(struct RTGGList * , struct RTGGadget * );
  118. void RefreshRTGGList(struct RTGGList * );
  119. BOOL DeleteRTGGList(struct RTGGList * , BOOL );
  120. void RTGGAddIPH(void);
  121. void RTGGRemIPH(void);
  122. BOOL RTGGOpenInput(void);
  123. void RTGGCloseInput(void);
  124. void DrawRTGGList(struct RTGGList * );
  125.  
  126.  
  127.  
  128. #endif  /* _RTGGADGETS_H_ */
  129.  
  130.